Skip to content

feat: add worktree management commands and per-worktree trunks#1224

Draft
ed-irl wants to merge 1 commit into
branch-comment-scopesfrom
branch-comment-extension-json
Draft

feat: add worktree management commands and per-worktree trunks#1224
ed-irl wants to merge 1 commit into
branch-comment-scopesfrom
branch-comment-extension-json

Conversation

@ed-irl

@ed-irl ed-irl commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Adds gs worktree create and gs worktree list, plus worktree-aware filtering across the stack.

Commands

  • gs worktree create <path> (alias wt c): creates a Git worktree. By default it sets up a per-worktree trunk — a local branch (named after the worktree dir, or --trunk) that tracks the same remote ref as the canonical trunk, so sync/restack in different worktrees never contend on one shared trunk checkout. --no-trunk keeps the legacy detached-HEAD behavior; -b/--branch also creates a tracked branch stacked on the worktree trunk.
  • gs worktree list (alias wt ls): lists worktrees with their checked-out branch and stack.

Per-worktree trunks

  • New worktree-trunks state key registers worktree-trunk branches. The key is additive and optional, so older repos/binaries are unaffected.
  • Store.IsTrunk/TrunkFor/WorktreeTrunks treat registered branches as trunk-equivalents: valid stack roots that may not themselves be tracked or deleted.
  • BranchGraph stops traversals at any trunk-equivalent, and gains StacksInWorktree to collect full stacks touching a worktree.
  • sync pulls the canonical remote trunk into the worktree's local trunk; the split is a no-op in the primary worktree.

Worktree filtering

  • -w/--worktree on log short and repo restack scopes operations to stacks checked out in the current worktree.
  • repo restack gains a WorktreeFilter and SkipCheckout on the restack handler.

Tests

  • Unit tests for the worktree-trunk registry and graph rooting.
  • Test scripts: worktree_create, worktree_list, log_short_worktree_filter, repo_restack_worktree_filter, and worktree-trunk branch create/restack regressions.

@ed-irl ed-irl force-pushed the branch-comment-extension-json branch from 63df853 to 8a8c3a0 Compare June 2, 2026 20:06
@ed-irl ed-irl force-pushed the branch-comment-scopes branch from 2f2d7a9 to 673dc16 Compare June 2, 2026 20:14
@ed-irl ed-irl force-pushed the branch-comment-scopes branch from 673dc16 to 3c58177 Compare June 2, 2026 22:30
@ed-irl ed-irl force-pushed the branch-comment-extension-json branch from a90b3d9 to 6582823 Compare June 2, 2026 22:35
@ed-irl ed-irl force-pushed the branch-comment-scopes branch from 3c58177 to 75e05c0 Compare June 8, 2026 10:19
@ed-irl ed-irl force-pushed the branch-comment-extension-json branch from 6582823 to 2ed2e4c Compare June 8, 2026 10:19
@ed-irl ed-irl force-pushed the branch-comment-scopes branch from e46ecf6 to 658c245 Compare June 8, 2026 11:15
@ed-irl ed-irl force-pushed the branch-comment-extension-json branch from 19612c8 to 3236937 Compare June 8, 2026 11:15
@ed-irl ed-irl force-pushed the branch-comment-scopes branch from 658c245 to 9b32be2 Compare June 12, 2026 20:07
@ed-irl ed-irl force-pushed the branch-comment-extension-json branch from 3236937 to 574274d Compare June 12, 2026 20:07
@ed-irl ed-irl force-pushed the branch-comment-scopes branch from 9b32be2 to b8a0e76 Compare June 13, 2026 13:39
@ed-irl ed-irl force-pushed the branch-comment-extension-json branch from 574274d to 1f36ef6 Compare June 13, 2026 13:39
@ed-irl ed-irl force-pushed the branch-comment-scopes branch from b8a0e76 to 9bb9a70 Compare June 15, 2026 09:53
@ed-irl ed-irl force-pushed the branch-comment-extension-json branch from 1f36ef6 to 6ba0470 Compare June 15, 2026 09:53
@ed-irl ed-irl force-pushed the branch-comment-scopes branch from 00e9ec6 to ed5caa4 Compare June 19, 2026 01:04
@ed-irl ed-irl changed the title branch comment: extend list --json shape per extension contract feat: add worktree management commands and per-worktree trunks Jun 19, 2026
@ed-irl ed-irl force-pushed the branch-comment-extension-json branch from 727d9c9 to f6e3920 Compare June 19, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant